//
//  NoDelayTableView.m
//  DYLYJ
//
//  Created by JM on 15/11/5.
//  Copyright © 2015年 JM. All rights reserved.
//

#import "NoDelayTableView.h"
//ios7  ios 8 问题
@implementation NoDelayTableView

- (id)initWithCoder:(NSCoder *)aDecoder {
    self = [super initWithCoder:aDecoder];
    if (self) {
        self.delaysContentTouches = NO;
        // iterate over all the UITableView's subviews
        for (id view in self.subviews) {
            // looking for a UITableViewWrapperView
            if ([NSStringFromClass([view class]) isEqualToString:@"UITableViewWrapperView"]) {
                // this test is necessary for safety and because a "UITableViewWrapperView" is NOT a UIScrollView in iOS7
                if([view isKindOfClass:[UIScrollView class]]) {
                    // turn OFF delaysContentTouches in the hidden subview
                    UIScrollView *scroll = (UIScrollView *) view;
                    scroll.delaysContentTouches = NO;
                } break;
            }
        }
    }
    return self;
}

- (BOOL)touchesShouldCancelInContentView:(UIView *)view {
    if ([view isKindOfClass:[UIButton class]]) { return YES; }
    return [super touchesShouldCancelInContentView:view];
}

@end
